#ifndef __TDP2_VFS_HPP__
#define __TDP2_VFS_HPP__

#include "../../rdx/src/rdx/rdx_io.hpp"
#include "tdp2_string.hpp"
#include "tdp2_hash.hpp"

namespace TDP
{
	namespace OS
	{
		class OSFileSystem : public RDX::IO::IFileSystem
		{
			DynString<Char> _workingDirectory;
			RDX::ObjectManagement::Allocator _alloc;
			RDX::IO::IFileScanState *_firstScanState;
			RDX::IO::IFileStream *_firstFile;

			RDX::Threading::LightMutex _mutex;

		public:
			OSFileSystem(const PanicHandler *ph, const Char *workingDirectory, const RDX::ObjectManagement::Allocator &alloc = TDP::Memory::DefaultAllocator());
			virtual ~OSFileSystem();

			RDX::IO::IFileStream *Open(const Char *path, bool write);
			RDX::IO::IFileScanState *ScanDirectory(const Char *directory, const Char *wildcard, const Char *vext);

			inline RDX::Threading::LightMutex *Mutex() { return &_mutex; }

			void UnlinkScanState(RDX::IO::IFileScanState *scanState);
			void UnlinkStream(RDX::IO::IFileStream *stream);

		};
	}
}



#endif
